﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.ServiceModel.DomainServices.Client;

namespace ZJUDTS
{
	public partial class Register : Page
	{
		Web.ZJUDTS2DomainContext ZjudtsData;
		public Register()
		{
			InitializeComponent();
			ZjudtsData = new Web.ZJUDTS2DomainContext();
			
			
			
		}

		// 当用户导航到此页面时执行。
		protected override void OnNavigatedTo(NavigationEventArgs e)
		{
		}

		private void Button_Click_1(object sender, RoutedEventArgs e)
		{
			Web.User NewUser = new Web.User();
			NewUser.Name = UserName.Text;
			NewUser.Password = Password.Password;
			NewUser.Email = Email.Text;
			NewUser.Money = 0;
			NewUser.Score = 0;
			ZjudtsData.Users.Add(NewUser);
			ZjudtsData.SubmitChanges();
			DataGrid.ItemsSource = ZjudtsData.Users;
			ZjudtsData.Load(ZjudtsData.GetUserSetQuery());
			MessageBox.Show("注册成功！");
		}


	}
}
